import { http } from "@/utils/http.js";

// 库存
export const appPlanQuery = (data) => {
  return http.request({
    method: "GET",
    url: "/app/plan/query",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存
export const appSelectorAll = (data) => {
  return http.request({
    method: "GET",
    url: "/app/storeCenter/selector",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const plan = (data) => {
  return http.request({
    method: "POST",
    url: "/app/plan",
    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const planCancel = (data) => {
  return http.request({
    method: "PATCH",
    url: "/app/plan/cancel",
    header: {
      "Content-Type": "application/x-www-form-urlencoded",
    },

    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const getPlan = (data) => {
  return http.request({
    method: "get",
    url: "/app/plan",
    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const getTakeSheetDetail = (data) => {
  return http.request({
    method: "get",
    url: "/app/takeSheet/detail",
    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const getPlanDetail = (data) => {
  return http.request({
    method: "get",
    url: "/app/plan/detail",
    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const appPlanProduct = (data) => {
  return http.request({
    method: "GET",
    url: "/app/plan/product",
    params: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const approveDirect = (data) => {
  return http.request({
    method: "POST",
    url: "/app/takeSheet/approve/direct",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const planDiff = (data) => {
  return http.request({
    method: "PATCH",
    url: "/app/plan/diff",
    header: {
      "Content-Type": "application/x-www-form-urlencoded",
    },

    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const planHandle = (data) => {
  return http.request({
    method: "PATCH",
    url: "/app/plan/handle",

    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const planConfig = (data) => {
  return http.request({
    method: "GET",
    url: "/app/plan/config",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const appTakeSheetQuery = (data) => {
  return http.request({
    method: "GET",
    url: "/app/takeSheet/query",
    params: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
